#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '../../maint/kdbg/procattachbase.ui'
**
** Created: Sun Dec 17 18:29:17 2006
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.6   edited Aug 31 2005 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "procattachbase.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <q3header.h>
#include <q3listview.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <q3whatsthis.h>
//Added by qt3to4:
#include <Q3HBoxLayout>
#include <Q3VBoxLayout>

/*
 *  Constructs a ProcAttachBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
ProcAttachBase::ProcAttachBase( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "ProcAttachBase" );
    setSizeGripEnabled( FALSE );
    ProcAttachBaseLayout = new Q3HBoxLayout( this, 10, 6, "ProcAttachBaseLayout"); 

    layout1 = new Q3VBoxLayout( 0, 0, 6, "layout1"); 

    textLabel3 = new QLabel( this, "textLabel3" );
    textLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, textLabel3->sizePolicy().hasHeightForWidth() ) );
    layout1->addWidget( textLabel3 );

    processList = new Q3ListView( this, "processList" );
    processList->addColumn( tr2i18n( "Command" ) );
    processList->addColumn( tr2i18n( "PID" ) );
    processList->addColumn( tr2i18n( "PPID" ) );
    processList->setMinimumSize( QSize( 300, 200 ) );
    processList->setAllColumnsShowFocus( TRUE );
    layout1->addWidget( processList );

    layout2 = new Q3HBoxLayout( 0, 0, 6, "layout2"); 

    pidLabel = new QLabel( this, "pidLabel" );
    layout2->addWidget( pidLabel );

    pidEdit = new QLineEdit( this, "pidEdit" );
    pidEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, pidEdit->sizePolicy().hasHeightForWidth() ) );
    pidEdit->setMaxLength( 20 );
    layout2->addWidget( pidEdit );

    processText = new QLabel( this, "processText" );
    processText->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)5, 1, 0, processText->sizePolicy().hasHeightForWidth() ) );
    layout2->addWidget( processText );
    layout1->addLayout( layout2 );

    layout3 = new Q3HBoxLayout( 0, 0, 6, "layout3"); 

    buttonRefresh = new QPushButton( this, "buttonRefresh" );
    buttonRefresh->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, buttonRefresh->sizePolicy().hasHeightForWidth() ) );
    layout3->addWidget( buttonRefresh );
    spacingBtns = new QSpacerItem( 242, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout3->addItem( spacingBtns );

    buttonOk = new QPushButton( this, "buttonOk" );
    buttonOk->setAutoDefault( TRUE );
    buttonOk->setDefault( TRUE );
    layout3->addWidget( buttonOk );

    buttonCancel = new QPushButton( this, "buttonCancel" );
    buttonCancel->setAutoDefault( TRUE );
    layout3->addWidget( buttonCancel );
    layout1->addLayout( layout3 );
    ProcAttachBaseLayout->addLayout( layout1 );
    languageChange();
    resize( QSize(560, 416).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( processList, SIGNAL( selectionChanged(Q3ListViewItem*) ), this, SLOT( processSelected(Q3ListViewItem*) ) );
    connect( buttonRefresh, SIGNAL( clicked() ), this, SLOT( refresh() ) );
    connect( pidEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( pidEdited(const QString&) ) );

    // tab order
    setTabOrder( processList, pidEdit );
    setTabOrder( pidEdit, buttonOk );
    setTabOrder( buttonOk, buttonCancel );

    // buddies
    textLabel3->setBuddy( processList );
    pidLabel->setBuddy( pidEdit );
}

/*
 *  Destroys the object and frees any allocated resources
 */
ProcAttachBase::~ProcAttachBase()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void ProcAttachBase::languageChange()
{
    setCaption( tr2i18n( "Attach to Process" ) );
    textLabel3->setText( tr2i18n( "&Currently running processes:" ) );
    processList->header()->setLabel( 0, tr2i18n( "Command" ) );
    processList->header()->setLabel( 1, tr2i18n( "PID" ) );
    processList->header()->setLabel( 2, tr2i18n( "PPID" ) );
    pidLabel->setText( tr2i18n( "&Process number:" ) );
    buttonRefresh->setText( tr2i18n( "&Refresh" ) );
    buttonOk->setText( tr2i18n( "&OK" ) );
    buttonOk->setAccel( QKeySequence( QString::null ) );
    buttonCancel->setText( tr2i18n( "&Cancel" ) );
    buttonCancel->setAccel( QKeySequence( QString::null ) );
}

#include "procattachbase.moc"
